In computer systems, an interrupt refers to a signal to a processor requesting the processor to switch its context. A valid interrupt stops the processor from carrying out its regular operations and redirect the processor control to a different location to handle the interrupt. Interrupts are useful for processing asynchronous events such as keyboard inputs and network inputs/outputs.
It is often useful for a system to selectively allow or disallow certain interrupts. Existing processors typically implement a global interrupt mask for determining which interrupts are allowable. Each bit in the global interrupt mask corresponds to a particular interrupt. A bit value of 0 typically means that the corresponding interrupt is enabled. If an instruction is executing while such an interrupt is pending, the instruction should context switch and handle the interrupt. A bit value of 1 usually means that the corresponding interrupt is not allowed and should be ignored if it is pending. All instructions handle interrupts in the same way according to the global interrupt mask.
While interrupt handling schemes using a global mask is useful in many systems, some issues remain. For example, efficiency problems associated with using global mask are common in virtual machine (VM) environments, where software running on an emulator system emulates the behavior of another platform. A single “virtual” instruction of the emulated platform is often emulated using several native instructions on the emulator system. To handle pending interrupts passed on by the emulator system to the emulated platform, some of the existing VM emulators poll for emulated interrupts at each native instruction. Polling is usually costly in terms of processor cycles and can lead to inefficiency. Thus, it would be desirable to have a more efficient way of handling interrupts, especially in virtual machine environments. It would also be useful to have greater flexibility in handling interrupts.